1
|
|
|
/*! |
2
|
|
|
* @author Semenov Alexander <[email protected]> |
3
|
|
|
* @link http://skeeks.com/ |
4
|
|
|
* @copyright 2010 SkeekS (СкикС) |
5
|
|
|
* @date 09.06.2015 |
6
|
|
|
*/ |
7
|
|
|
(function(sx, $, _) |
|
|
|
|
8
|
|
|
{ |
9
|
|
|
sx.classes.ComponentSettingsWidget = sx.classes.Component.extend({ |
10
|
|
|
|
11
|
|
|
getjWrapper: function() |
12
|
|
|
{ |
13
|
|
|
return $("#" + this.get('id')); |
14
|
|
|
}, |
15
|
|
|
|
16
|
|
|
getjBtnEdit: function() |
17
|
|
|
{ |
18
|
|
|
return $(".sx-btn-edit", this.getjWrapper()); |
19
|
|
|
}, |
20
|
|
|
|
21
|
|
|
getjComponentSelect: function() |
22
|
|
|
{ |
23
|
|
|
return $("#" + this.get('componentSelectId')); |
24
|
|
|
}, |
25
|
|
|
getjComponentSettings: function() |
26
|
|
|
{ |
27
|
|
|
return $("#" + this.get('componentSettingsId')); |
28
|
|
|
}, |
29
|
|
|
|
30
|
|
|
_onDomReady: function() |
31
|
|
|
{ |
32
|
|
|
var self = this; |
33
|
|
|
|
34
|
|
|
this.getjComponentSelect().on("change", function() |
35
|
|
|
{ |
36
|
|
|
self.currentComponent = $(this).val(); |
37
|
|
|
self.update(); |
38
|
|
|
}); |
39
|
|
|
|
40
|
|
|
this.getjBtnEdit().on('click', function() |
41
|
|
|
{ |
42
|
|
|
self.goEdit(); |
43
|
|
|
return false; |
44
|
|
|
}); |
45
|
|
|
|
46
|
|
|
this.currentComponent = this.getjComponentSelect().val(); |
47
|
|
|
self.update(); |
48
|
|
|
}, |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Обновление текущего состояния |
52
|
|
|
* @returns {sx.classes.ComponentSettingsWidget} |
53
|
|
|
*/ |
54
|
|
|
update: function() |
55
|
|
|
{ |
56
|
|
|
var self = this; |
57
|
|
|
|
58
|
|
|
if (!self.currentComponent) |
59
|
|
|
{ |
60
|
|
|
this.getjBtnEdit().hide(); |
61
|
|
|
} else |
62
|
|
|
{ |
63
|
|
|
this.getjBtnEdit().show(); |
64
|
|
|
} |
65
|
|
|
return this; |
66
|
|
|
}, |
67
|
|
|
|
68
|
|
|
save: function(dataStringB64) |
69
|
|
|
{ |
70
|
|
|
var old = this.getjComponentSettings().val(); |
71
|
|
|
this.getjComponentSettings().val(dataStringB64); |
72
|
|
|
var newVal = this.getjComponentSettings().val(); |
73
|
|
|
|
74
|
|
|
if (newVal != old) |
75
|
|
|
{ |
76
|
|
|
console.log('changed'); |
|
|
|
|
77
|
|
|
} |
78
|
|
|
this.windowObject.close(); |
79
|
|
|
}, |
80
|
|
|
|
81
|
|
|
goEdit: function() |
82
|
|
|
{ |
83
|
|
|
var url = this.get('backend'); |
84
|
|
|
url = url + '?'; |
85
|
|
|
url = url + "&component=" + this.currentComponent; |
86
|
|
|
url = url + "&settings=" + this.getjComponentSettings().val(); |
87
|
|
|
url = url + "&callbackComonentId=" + this.get('id'); |
88
|
|
|
|
89
|
|
|
this.windowObject = new sx.classes.Window(url); |
90
|
|
|
this.windowObject.open(); |
91
|
|
|
}, |
92
|
|
|
}); |
93
|
|
|
})(sx, sx.$, sx._); |
|
|
|
|
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.